HAL COMP Types

HAL COMP Types

group COMP_Exported_Types

Typedefs

typedef struct hal_comp_handle_s hal_comp_handle_t

COMP handle type definition

typedef void ( * hal_comp_cb_t ) ( hal_comp_handle_t * hcomp )

pointer to COMP callback functions

Enums

enum hal_comp_t

HAL COMP instance.

Values:

enumerator HAL_COMP1
enum hal_comp_state_t

COMP Global state.

Values:

enumerator HAL_COMP_STATE_RESET

HAL Comparator handle not yet initialized

enumerator HAL_COMP_STATE_INIT

HAL Comparator handle initialized but comparator not yet configured

enumerator HAL_COMP_STATE_IDLE

Comparator configured

enumerator HAL_COMP_STATE_ACTIVE

Comparator operating

enumerator HAL_COMP_STATE_LINKED

HAL Comparator handle linked to other comparator handle

enum hal_comp_power_mode_t

HAL COMP power mode.

Note

For the electrical characteristics of comparator power modes (propagation delay, power consumption), refer to device datasheet.

Values:

enumerator HAL_COMP_POWER_MODE_HIGH_SPEED

Comparator power mode to high speed Comparator power mode to high speed

enumerator HAL_COMP_POWER_MODE_MEDIUM_SPEED

Comparator power mode to medium speed Comparator power mode to medium speed

enumerator HAL_COMP_POWER_MODE_ULTRA_LOW_POWER

Comparator power mode to ultra-low power Comparator power mode to ultra-low power

enum hal_comp_input_plus_t

HAL COMP input plus.

Values:

enumerator HAL_COMP_INPUT_PLUS_IO1

Comparator input plus connected to IO1 (for GPIO mapping, refer to the datasheet parameters “COMPx_INP1”). Comparator input plus connected to IO1 (for GPIO mapping, refer to the datasheet parameters “COMPx_INP1”).

enumerator HAL_COMP_INPUT_PLUS_IO2

Comparator input plus connected to IO2 (for GPIO mapping, refer to the datasheet parameters “COMPx_INP2”). Comparator input plus connected to IO2 (for GPIO mapping, refer to the datasheet parameters “COMPx_INP2”).

enumerator HAL_COMP_INPUT_PLUS_IO3

Comparator input plus connected to IO3 (for GPIO mapping, refer to the datasheet parameters “COMPx_INP3”). Comparator input plus connected to IO3 (for GPIO mapping, refer to the datasheet parameters “COMPx_INP3”).

enumerator HAL_COMP_INPUT_PLUS_DAC1_CH1

Comparator input plus connected to DAC1 channel 1. Specific to COMP instance: COMP1. Comparator input plus connected to DAC1 channel 1. Specific to COMP instance: COMP1.

enum hal_comp_input_minus_t

HAL COMP input minus.

Values:

enumerator HAL_COMP_INPUT_MINUS_VREFINT

Comparator input minus connected to VrefInt (for VrefInt voltage value, refer to the datasheet). Comparator input minus connected to VrefInt (for VrefInt voltage value, refer to the datasheet).

enumerator HAL_COMP_INPUT_MINUS_1_4VREFINT

Comparator input minus connected to 1/4 VrefInt (for VrefInt voltage value, refer to the datasheet). Comparator input minus connected to 1/4 VrefInt (for VrefInt voltage value, refer to the datasheet).

enumerator HAL_COMP_INPUT_MINUS_1_2VREFINT

Comparator input minus connected to 1/2 VrefInt (for VrefInt voltage value, refer to the datasheet). Comparator input minus connected to 1/2 VrefInt (for VrefInt voltage value, refer to the datasheet).

enumerator HAL_COMP_INPUT_MINUS_3_4VREFINT

Comparator input minus connected to 3/4 VrefInt (for VrefInt voltage value, refer to the datasheet). Comparator input minus connected to 3/4 VrefInt (for VrefInt voltage value, refer to the datasheet).

enumerator HAL_COMP_INPUT_MINUS_IO1

Comparator input minus connected to IO1 (for GPIO mapping, refer to the datasheet parameters “COMPx_INM1”). Comparator input minus connected to IO1 (for GPIO mapping, refer to datasheet parameters “COMPx_INM1”).

enumerator HAL_COMP_INPUT_MINUS_IO2

Comparator input minus connected to IO2 (for GPIO mapping, refer to the datasheet parameters “COMPx_INM2”). Comparator input minus connected to IO2 (for GPIO mapping, refer to datasheet parameters “COMPx_INM2”).

enumerator HAL_COMP_INPUT_MINUS_IO3

Comparator input minus connected to IO3 (for GPIO mapping, refer to the datasheet parameters “COMPx_INM3”). Comparator input minus connected to IO3 (for GPIO mapping, refer to datasheet parameters “COMPx_INM3”).

enumerator HAL_COMP_INPUT_MINUS_DAC1_CH1

Comparator input minus connected to DAC1 channel 1. Specific to COMP instances: COMP1. Comparator input minus connected to DAC1 channel 1. Specific to COMP instances: COMP1.

enumerator HAL_COMP_INPUT_MINUS_TEMPSENSOR

Comparator input minus connected to the internal temperature sensor (also accessible through the ADC peripheral). Call function LL_COMP_EnableInputTempSensorBuffer(). Comparator input minus connected to the internal temperature sensor (also accessible through the ADC peripheral). Note: Specific configuration with bitfields out of comparator registers due to the temperature sensor buffer controlled by the ADC clock domain. Caution: ADC clock domain reset or disable affects the temperature sensor.

enum hal_comp_input_hysteresis_t

HAL COMP input hysteresis.

Note

Hysteresis applied to input plus, subtracted to input voltage value.

Note

For the electrical characteristics of comparator hysteresis (voltage amplitude), refer to device datasheet.

Values:

enumerator HAL_COMP_INPUT_HYSTERESIS_NONE

No hysteresis Comparator input without hysteresis

enumerator HAL_COMP_INPUT_HYSTERESIS_LOW

Hysteresis level low Comparator input hysteresis level low

enumerator HAL_COMP_INPUT_HYSTERESIS_MEDIUM

Hysteresis level medium Comparator input hysteresis level medium

enumerator HAL_COMP_INPUT_HYSTERESIS_HIGH

Hysteresis level high Comparator input hysteresis level high

enum hal_comp_output_polarity_t

HAL COMP output polarity.

Values:

enumerator HAL_COMP_OUTPUT_POLARITY_NONINVERTED

Comparator output polarity not inverted: comparator output at high level when input voltages: plus higher than minus Comparator output polarity not inverted: comparator output at high level when input voltages: plus higher than minus

enumerator HAL_COMP_OUTPUT_POLARITY_INVERTED

Comparator output polarity not inverted: comparator output at low level when input voltages: plus higher than minus Comparator output polarity not inverted: comparator output at low level when input voltages: plus higher than minus

enum hal_comp_output_blank_t

HAL COMP output blanking.

Values:

enumerator HAL_COMP_OUTPUT_BLANK_NONE

Comparator output without blanking Comparator output without blanking.

enumerator HAL_COMP_OUTPUT_BLANK_TIM1_OC5

Comparator output blanking source TIM1 OC5, specific to instance: COMP1. Comparator output blanking source TIM1 OC5.

enumerator HAL_COMP_OUTPUT_BLANK_TIM1_OC6

Comparator output blanking source TIM1 OC6, specific to instance: COMP2. Comparator output blanking source TIM1 OC6.

enumerator HAL_COMP_OUTPUT_BLANK_TIM2_OC3

Comparator output blanking source TIM2 OC3. Comparator output blanking source TIM2 OC3.

enumerator HAL_COMP_OUTPUT_BLANK_TIM5_OC3

Comparator output blanking source TIM5 OC3. Comparator output blanking source TIM5 OC3.

enumerator HAL_COMP_OUTPUT_BLANK_TIM5_OC4

Comparator output blanking source TIM5 OC4. Comparator output blanking source TIM3 OC4.

enumerator HAL_COMP_OUTPUT_BLANK_TIM8_OC5

Comparator output blanking source TIM8 OC5. Comparator output blanking source TIM8 OC5.

enumerator HAL_COMP_OUTPUT_BLANK_TIM15_OC2

Comparator output blanking source TIM15 OC2. Comparator output blanking source TIM15 OC2.

enumerator HAL_COMP_OUTPUT_BLANK_LPTIM1_OC1

Comparator output blanking source LPTIM1 OC1, specific to instance: COMP2. Comparator output blanking source LPTIM1 OC1.

enum hal_comp_output_trigger_t

HAL COMP output trigger to system.

Note

When output set to generate a trigger, impact depends on programming model used:

Values:

enumerator HAL_COMP_OUTPUT_TRIG_NONE

No Trigger Mode Comparator output does not generate a trigger

enumerator HAL_COMP_OUTPUT_TRIG_RISING

Trigger Rising Mode Comparator output generates a trigger event to system on rising edge

enumerator HAL_COMP_OUTPUT_TRIG_FALLING

Trigger Falling Mode Comparator output generates a trigger event to system on falling edge

enumerator HAL_COMP_OUTPUT_TRIG_RISING_FALLING

Trigger Rising & Falling Mode Comparator output generates a trigger event to system on both rising and falling edges

enum hal_comp_lock_status_t

HAL COMP lock state.

Values:

enumerator HAL_COMP_LOCK_DISABLED

Comparator not locked

enumerator HAL_COMP_LOCK_ENABLED

Comparator locked

enum hal_comp_output_level_t

HAL COMP output level.

Note

Comparator output level depends on inputs voltages and output polarity.

Values:

enumerator HAL_COMP_OUTPUT_LEVEL_LOW

Comparator output level low (with polarity not inverted) Comparator output logical level low

enumerator HAL_COMP_OUTPUT_LEVEL_HIGH

Comparator output level high (with polarity not inverted) Comparator output logical level high

struct hal_comp_config_t
#include <stm32c5xx_hal_comp.h>

COMP Global configuration.

Public Members

hal_comp_power_mode_t power_mode

Comparator power mode

hal_comp_input_plus_t input_plus

Comparator input plus

hal_comp_input_minus_t input_minus

Comparator input minus

hal_comp_input_hysteresis_t input_hysteresis

Comparator input hysteresis

hal_comp_output_polarity_t output_polarity

Comparator output polarity

hal_comp_output_trigger_t output_trigger

Comparator output trigger to system (wake up, CPU)

struct hal_comp_handle_s
#include <stm32c5xx_hal_comp.h>

COMP Handle Structure Definition.

Public Members

hal_comp_t instance

Peripheral instance

volatile hal_comp_state_t global_state

Global state

const void * p_user_data

User data pointer

hal_comp_cb_t p_output_trigger_cb

COMP output trigger callback

uint32_t exti_line

EXTI line (needed for event and IT operation) on LL driver format

hal_comp_output_trigger_t output_trigger

Comparator output trigger configured